package util;

import org.springframework.util.ReflectionUtils;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * Created by chenyipu on 2017/9/7.
 */
public class MyInvocationHandler implements InvocationHandler{
    Object realObject;
    public MyInvocationHandler(Object object){
        realObject =object;
    }
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        long start  = System.currentTimeMillis();
        Object o = method.invoke(realObject,args);
        long end  = System.currentTimeMillis();
        System.out.println("METHOD:"+method.getName()+" RUNS:"+(end-start)+"(ms).");
        return o;
    }
}
